<template>
<div class="school">
  <h1>这是校区</h1>
  <p>这是{{info}}校区</p>
  <button @click="xueyuandianji">这是学员信息</button><button @click="jiuyedianji">这是学员就业信息</button>
  <div>
      <router-view></router-view>
  </div>
</div>

</template>

<script>
export default {
data(){
return {
    info:'?'

}

},

props:['id'],
methods: {
    deal(id){
        if (id==='1') {
        this.info='广州'
    }else if(id==='2'){
        this.info='深圳'
    }else if(id==='3'){
        this.info='杭州'
    }else if(id==='4'){
        this.info='上海'
    }else if(id==='5'){
        this.info='福建'
    }else if(id==='6'){
        this.info='北京'
    }
    }, 
    xueyuandianji(){
        this.$router.push({path:`/school/${this.id}/xueyuan`}).catch(()=>{})
        // this.$router.push({path})
    },
    jiuyedianji(){
        this.$router.push({path:`/school/${this.id}/jiuye`}).catch(()=>{})
        console.log(this.id);
    }
},
mounted(){
    // console.log(this.$route);
    let id = this.$route.params.id
    // console.log(id);
    this.deal(id)
},
watch: {
    $route(to,from){
        // console.log(to,from);
        let id = to.params.id
        this.deal(id)
    }
}
}
</script>
<style lang='less' scoped>
.school{
    background-color: pink;
    // border: 50px solid #ccc;
    }
</style>
